package com.ruoyi.web.controller.teacher;


import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.teacher.domain.Teacher;
import com.ruoyi.teacher.mapper.TeacherDto;
import com.ruoyi.teacher.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
@RequestMapping("/system/teacher")
public class TeacherController {
    @Autowired
    private TeacherService teacherService;


    @GetMapping("/list")
    public AjaxResult getList(String name) {
        List<Teacher> list = teacherService.getList(name);
        return AjaxResult.success("成功", list);
    }

    @PostMapping("/save")
    public AjaxResult getSave(@RequestBody Teacher teacher) {
        System.out.println(teacher);
        return teacherService.getSave(teacher);
    }

    @DeleteMapping("/{id}")
    public AjaxResult getDelete(@PathVariable Long id) {
        System.out.println(id);
        teacherService.getDelete(id);
        return AjaxResult.success();
    }


}
